package coffee;

import dagger.Lazy;
import javax.inject.Inject;

class CoffeeMaker {
	/**
	 * Create a possibly costly heater only when we use it.
	 * 只有当我们使用它时才创造一个可能昂贵的加热器
	 */
  private final Lazy<Heater> heater;
  private final Pump pump;

  @Inject 
  CoffeeMaker(Lazy<Heater> heater, Pump pump) {
    this.heater = heater;
    this.pump = pump;
  }

  public void brew() {
    heater.get().on();
    pump.pump();
    System.out.println(" [_]P coffee! [_]P ");
    heater.get().off();
  }
}
